package com.gas.project.gas.student.domain;

import java.util.Arrays;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gas.framework.aspectj.lang.annotation.Excel;
import com.gas.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 学生信息管理对象 gas_student
 *
 * @author xyl
 * @date 2022-04-01
 */
public class Student extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 学生学号，和用户表登录关联
     */
    @Excel(name = "学生学号")
    private String studentNumber;

    /**
     * 学生姓名
     */
    @Excel(name = "学生姓名")
    private String studentName;

    /**
     * 学生类型（专升本，普通本科）
     */
    @Excel(name = "学生类型")
    private String studentType;

    /**
     * 性别
     */
    @Excel(name = "性别")
    private String gender;

    /**
     * 入学时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "入学时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date admissionsTime;

    /**
     * 学院名称
     */
    @Excel(name = "学院名称")
    private String collegeName;

    /**
     * 专业名称
     */
    @Excel(name = "专业名称")
    private String majorName;

    /**
     * 班级名称
     */
    @Excel(name = "班级名称")
    private String className;

    /**
     * 毕业状态
     */
    @Excel(name = "毕业状态")
    private String graduationStatus;

    /**
     * 毕业时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "毕业时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date graduationTime;

    /**
     * 指导老师工号（对应用户表）
     */
    @Excel(name = "指导老师工号")
    private String teacherNumber;

    private Integer inYear;

    private String isExcellent;

    public String getIsExcellent() {
        return isExcellent;
    }

    public void setIsExcellent(String isExcellent) {
        this.isExcellent = isExcellent;
    }

    public Integer getInYear() {
        return inYear;
    }

    public void setInYear(Integer inYear) {
        this.inYear = inYear;
    }

    public void setStudentNumber(String studentNumber) {
        this.studentNumber = studentNumber;
    }

    public String getStudentNumber() {
        return studentNumber;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentType(String studentType) {
        this.studentType = studentType;
    }

    public String getStudentType() {
        return studentType;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getGender() {
        return gender;
    }

    public void setAdmissionsTime(Date admissionsTime) {
        this.admissionsTime = admissionsTime;
    }

    public Date getAdmissionsTime() {
        return admissionsTime;
    }

    public void setCollegeName(String collegeName) {
        this.collegeName = collegeName;
    }

    public String getCollegeName() {
        return collegeName;
    }

    public void setMajorName(String majorName) {
        this.majorName = majorName;
    }

    public String getMajorName() {
        return majorName;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getClassName() {
        return className;
    }

    public void setGraduationStatus(String graduationStatus) {
        this.graduationStatus = graduationStatus;
    }

    public String getGraduationStatus() {
        return graduationStatus;
    }

    public void setGraduationTime(Date graduationTime) {
        this.graduationTime = graduationTime;
    }

    public Date getGraduationTime() {
        return graduationTime;
    }

    public void setTeacherNumber(String teacherNumber) {
        this.teacherNumber = teacherNumber;
    }

    public String getTeacherNumber() {
        return teacherNumber;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("studentNumber", getStudentNumber())
                .append("studentName", getStudentName())
                .append("studentType", getStudentType())
                .append("gender", getGender())
                .append("admissionsTime", getAdmissionsTime())
                .append("collegeName", getCollegeName())
                .append("majorName", getMajorName())
                .append("className", getClassName())
                .append("graduationStatus", getGraduationStatus())
                .append("graduationTime", getGraduationTime())
                .append("teacherNumber", getTeacherNumber())
                .append("createTime", getCreateTime())
                .append("createBy", getCreateBy())
                .append("updateTime", getUpdateTime())
                .append("updateBy", getUpdateBy())
                .append("remark", getRemark())
                .toString();
    }

    public String check(Student student) {
        if (StringUtils.isBlank(student.getStudentNumber())) {
            return "学生学号不能为空！";
        }
        if (StringUtils.isBlank(student.getStudentName())) {
            return "学生姓名不能为空！";
        }
        if (StringUtils.isBlank(student.getStudentType())) {
            return "学生类型不能为空！";
        }
        if (!Arrays.asList("专升本","本科").contains(student.getStudentType().trim())) {
            return "学生类型只能为：专升本 或 本科！";
        }
        if (StringUtils.isBlank(student.getCollegeName())) {
            return "学院不能为空！";
        }
        if (StringUtils.isBlank(student.getMajorName())) {
            return "专业不能为空！";
        }
        if (StringUtils.isBlank(student.getClassName())) {
            return "班级不能为空！";
        }
        if (StringUtils.isBlank(student.getGraduationStatus())) {
            return "在校状态不能为空（在校 或 已毕业）！";
        }
        if (!Arrays.asList("在校","已毕业").contains(student.getGraduationStatus().trim())) {
            return "学生类型只能为：在校 或 已毕业！";
        }
        return null;
    }
}
